From e35a00a12e2fa29308b9ffe596eed4e94e280186 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 9 Jan 2017 06:51:37 -0800 Subject: [PATCH] Replace static mut bool with atomicbool --- tests/cross-compile.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/cross-compile.rs b/tests/cross-compile.rs index 874698b34..f408b42ba 100644 --- a/tests/cross-compile.rs +++ b/tests/cross-compile.rs @@ -31,7 +31,7 @@ fn disabled() -> bool { // It's not particularly common to have a cross-compilation setup, so // try to detect that before we fail a bunch of tests through no fault // of the user. - static mut CAN_RUN_CROSS_TESTS: bool = false; + static CAN_RUN_CROSS_TESTS: AtomicBool = ATOMIC_BOOL_INIT; static CHECK: Once = ONCE_INIT; let cross_target = alternate(); @@ -46,13 +46,11 @@ fn disabled() -> bool { .exec_with_output(); if result.is_ok() { - unsafe { - CAN_RUN_CROSS_TESTS = true; - } + CAN_RUN_CROSS_TESTS.store(true, Ordering::SeqCst); } }); - if unsafe { CAN_RUN_CROSS_TESTS } { + if CAN_RUN_CROSS_TESTS.load(Ordering::SeqCst) { // We were able to compile a simple project, so the user has the // necessary std:: bits installed. Therefore, tests should not // be disabled. -- 2.30.2